import type { ConfigEnv, UserConfig } from "vite";

import { configPlugins } from "./build/plugin";
import { resolve } from "node:path";

export default async ({ mode }: ConfigEnv): Promise<UserConfig> => {
  const root = process.cwd();
  const isProduction = mode === "production";
  const isDevelopment = mode === "development";

  const alias = {
    "@": resolve(root, "src"),
  };

  return {
    root,
    plugins: await configPlugins(),
    resolve: {
      alias,
    },
    css: {
      postcss: {
        plugins: [require("postcss-import"), require("tailwindcss")],
      },
    },
  };
};
